using System;
using MvcMall.Core.Domains;
using MvcMall.Core.Enums;
using MvcMall.Portal.Controllers.Stores.ViewModels;

namespace MvcMall.Portal.Controllers.Stores.Mappers
{
    public class GoodsDomainToStoreGoodsModelMapper
    {
        public StoreGoodDtoModel MapFrom(Goods input)
        {
            var model = new StoreGoodDtoModel
                            {
                                GoodsBrandName = input.GoodsBrand == null ? string.Empty : input.GoodsBrand.BrandName,
                                GoodsCatName = input.GoodsCategory == null ? string.Empty : input.GoodsCategory.CatName,
                                GoodsName = input.GoodsName,
                                GoodsNumber = input.GoodsNumber,
                                GoodsThumb = input.GoodsThumb,
                                Id = input.Id,
                                IsPromoted = input.IsPromoted,
                                StorePrice = input.ShopPrice,
                                IsPublish = input.IsPublish
                            };
            return model;
        }
    }
}